<!doctype html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=7">
        <title>Flash</title>
        <script src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" type="text/javascript">
        </script>
        <style>
            body {
                background-color: red;
            }
        </style>
    </head>
    <body>
        DOMA<input type="text" id="txtIn" value="bb"/>
        <button onclick="send()">
            send
        </button>
        <br/>
        <div id="output">
        </div>
        <div id="altContent">
        </div>
        <script type="text/javascript">
            var channelId = Math.floor(Math.random() * 100) * 100;
            
            function init(){
                console.log("init " + channelId);
                swf = document.getElementById(attributes.id);
                
                swf.createChannel("easyXDM_channel" + channelId, "http://xdm2.local", true, "foo[\"onMessage\"]", "key");
                
                var ifr = document.createElement("iframe");
                document.body.appendChild(ifr);
                ifr.src = "http://xdm2.local/easyXDM/src/flash/test/domb.html#" + channelId;
                
            }
            
            var foo = {
                onMessage: function(msg, origin){
                    document.getElementById("output").appendChild(document.createTextNode(msg + "-foo:" + origin));
                    
                }
            };
            function log(msg){
                console.log(location.host + ": " + msg);
            }
            
            function send(){
                swf.postMessage("easyXDM_channel" + channelId, document.getElementById("txtIn").value, "http://xdm2.local");
            }
            
            var flashvars = {
				init:"init"
			};
            var params = {
                menu: "false",
                scale: "noScale",
                allowFullscreen: "true",
                allowScriptAccess: "always",
                bgcolor: "#FFFFFF"
            };
            var attributes = {
                id: "neteasyxdmflash"
            };
            swfobject.embedSWF("../../../tools/easyxdm.swf", "altContent", "10", "10", "8.0.0", "expressInstall.swf", flashvars, params, attributes);
        </script>
    </body>
</html>
